import java.util.Scanner;

/**
 * 最长回文字符串
 * 给定一个仅包含小写字母的字符串，求它的最长回文子串的长度。
 */
public class HJ85 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String str = scanner.nextLine();
            int length = str.length();
            int max = 0;
            for (int i = 0; i < length; i++) {
                for (int j = length; j >= i; j--) {
                    if(isReverseString(str.substring(i,j))){
                        max = Math.max(j-i,max);
                    }
                }
            }
            System.out.println(max);
        }
    }

    private static boolean isReverseString(String s) {
        if(s.length()%2 != 0){
            return false;
        }
        for (int i = 0; i < s.length() / 2; i++) {
            if(s.charAt(i) != s.charAt(s.length()-1-i)){
                return false;
            }
        }
        return true;
    }
}
